home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
hardware
/
blizkick
/
blizkick.asm
< prev
next >
Wrap
Assembly Source File
|
1999-05-17
|
63KB
|
2,982 lines
; FILE: Source:BlizKick.ASM REV: 468 --- BlizKick
; History
; 1 Running OK!
; 15 Now BlizKick should work with all Blizzard turbos.
; 19 Now BlizKick should even support KS 1.0... (?)
; 25 Added LOCALFAST feature.
; 31 Added QUICKBOOT feature.
; 33 Added better Printf.
; 48 Added Better ROM identification code (checksum).
; 65 Added "real" cache clear routine.
; 69 Fixed _seek bug.
; 71 Fixed KS 1.3 SPEEDROM bug.
; 81 Replaced "execinit" patch with resident tag.
; 107 Fix for Blizzard 1260! 1230-IV too!!
; 111 Added original Kickstart restoration.
; 114 Implemented KS1.x KS restoration.
; 115 Improved error messages.
; 116 Improved MAPROM test and CacheClear routine.
; 125 Added HOGWAITBLIT feature.
; 129 Added SetPatch (680x0.library) check.
; 175 Added MODULE feature.
; 186 Added EXTRESBUF feature.
; 210 Added External patches and BKMF_ExtResBuf flag, fixed 1.x ROMTag support.
; 215 Fixed LOCALFAST feature not to force MEMF_LOCAL or MEMF_KICK!
; 220 Fixed KS 1.x ROMTag support.
; 225 Added special handling for 1230-IV and 1260. Fixed FORCE.
; 240 Removed need to be run before SetPatch on 1260 systems.
; 248 Can be used with Enforcer, CPU FASTROM, VMM etc.
; 257 Improved 040/060 cache flushing code. BlizKick release 1.6.
; 266 Fixed bug in 040/060 MMU test code.
; 276 Added XPK support.
; 277 Modified to work better with PowerPC... :)
; 279 Added better (Old)OpenLibrary code. Removed FindName() things.
; 289 Fixed XPK support.
; 293 Now will set memory node name if null.
; 300 Fixed EXTRESBUF.
; 302 Fixed negative return code bug.
; 307 Added ROM address validity test.
; 311 Fixed BLIZZARD 2060 code.
; 313 Fixed one terrible bug from B2060 code.
; 328 Fixing EXTRESBUF...
; 332 Finished! Now it should work with 1260, 2040 and 2060.
; 338 DOES work on 1260. Fixed one minor bug. SoftSCSI module doesn't work.
; 340 Added memheader move code to LOCALFAST. -> Speed AllocMem()
; 343 Fixed reset code!
; 344 Allowed BlizKick to kick same kickfile and rom chip version.
; 348 Fixed .testblizppcrunnommu. Added pseudofile (*) feature.
; 353 Added LastPatches (fix for MEMF_REVERSE svstack, etc.)
; 361 Fixed svstack trash, disabled SVSTACKTRASH.
; 377 Added QUIET switch, fixed LastPatches, KS 33.180 works now!
; 388 Got KS 33.180 finally work 100%.
; 389 Added handling for BKMODPATH env variable.
; 399 Improved HOGWAITBLIT.
; 400 Found out that 2040 and 2060 boards are almost identical.
; 403 Fixed reset code to *disable* caches.
; 404 1.11ß1: Trying to get EXTRESBUF into fastmem.
; 412 Did it. Seems to work 100%.
; 415 Fixed MAPROM test. Now should detect if MAPROM not set.
; 416 Disabled SUPERVISOR_NOREVERSE from LastPatches.
; 421 Added support for (A4000?) CPU Cards.
; 425 Now KS 1.x are only patched if they're original versions. This should
; prevent problems with some patches 1.x ROM images.
; 426 Fixed bug in ROM image validation test.
; 427 9th Dec 1997: ARGH! Wrote nice CPUCard support but forgot to enable
; it!!! ;-)
; 429 Added support for Cyberstorm PPC and MKIII. Now should work at least
; with CBM CPU Cards, Cyberstorm MKI, MKIII and PPC.
; 439 Separated A1200 and other model's check routines. Hopefully fixed CS
; MKIII/PPC support. Added CS MKII support. Now CPUCARD is only meant to
; be used with CS MKI & compatible.
; 442 Fixed few typos etc.
; 443 Fixed stupid BUG from CS support... THANKS DUKEN!! =)
; 444 Had mixed 20x0 and CS MK II product IDs... doh! Thanks shido at #amiga!
; 445 Fixed some Lock bugs.
; 446 13th May 1998 Made the source public in hope someone would continue the
; development.
; 450 6th July 1998 Added Blizzard PPC support.
; 458 8th July 1998 Fixed Blizzard PPC and CS MKII support (I hope).
; 459 17th July 1998 Fixed stupid bug from CS MKII support.
; 461 4th October 1998 Finally fixed the blizz ppc bug. hehe.
; 462 6th October 1998 Fixed support for old KS.
; 463 9th October 1998 Fixed MK2 bug. Ta ChaoZer.
; 464 13th October 1998 Another MK2 fix <sigh>. Ta ChaoZer.
; 467 3rd November 1998 Disabled rom checksum disable in SPEEDROM.
; 468 24th January 1999 Fixed stupid blizzppc (and probably CSPPC too)
; bug, blizzppc/csppc kernel overwrote EXTRES buffer. Now allocates
; 1mb extra memory.
;
;
; I seriously doubt if this source code is useful for anything else.
; Hairy code everywhere, this one is really a bitch to maintain...
;
; TODO
; o Support for 2040 and 2060 scsi rom.
; o ROM checksum (restore orig rom if bad)
; (possibly)
; o IDEFix97 module (rs:LoadIDE.rs)
; o OxyPatcher module
; o ENVARC: ENV: etc.
; o args from file
; o module memory requirements inside the module itself ('$LEN: 280' ?)
; o Problem with MoveVBR module on 1240??
; o Crash when running BlizKick after SetPatch on 2040??
; ? FastExec (LOCALFAST) didn't work (on 1260) if started after SetPatch ??
;
; o Add possibility to plant any single hunk device or library.
; ^ Support for scsi.device module (GetSCSI)
; o Fix QUICKBOOT for 1230-IV & 1260
; ^ Fix 1230-IV scsi-kit problems ? PROBABLY FIXED
USE_STD_INCLUDES SET 1
IFNE USE_STD_INCLUDES
MACHINE MC68040
include "exec/types.i"
include "exec/nodes.i"
include "exec/libraries.i"
include "exec/memory.i"
include "exec/execbase.i"
include "exec/resident.i"
include "exec/alerts.i"
include "dos/dos.i"
include "exec/exec_lib.i"
include "dos/dos_lib.i"
include "graphics/gfxbase.i"
include "graphics/graphics_lib.i"
call MACRO
jsr (_LVO\1,a6)
ENDM
ELSE
include "Devpac:Gen.gs"
ENDC
include "dos/dosextens.i"
include "libraries/configvars.i"
include "libraries/expansion_lib.i"
include "hardware/dmabits.i"
include "hardware/custom.i"
include "libraries/xpk.i" ; from xpk_dev
include "blizkickmodule.i"
ARG_KICKFILE EQU 0
ARG_MODULE EQU 4
ARG_EXTRESBUF EQU 8
ARG_FORCE EQU 12
ARG_LOCALFAST EQU 16
ARG_QUICKBOOT EQU 20
ARG_SPEEDROM EQU 24
ARG_HOGWAITBLIT EQU 28
ARG_CPUCARD EQU 32
ARG_QUIET EQU 36
BUFSIZEL EQU $10000
BLIZPROD EQU $2140
ROMSUMOFFS EQU -$18
ROMSIZEOFFS EQU -$14
IDOFFS EQU -$10
BLIZKICK_ID EQU 'BlzK'
KEEP_CHECKSUM EQU 1 ;don't disable rom checksum
;SVSTACKTRASH EQU 8*1024 ;16384
CACHEFLUSH040 MACRO
dc.w $4E71 ; nop
dc.w $F478 ; CPUSHA BC flush the data into memory
dc.w $4E71 ; nop
ENDM
FULLFLUSH040 MACRO
dc.w $4E71 ; nop
dc.w $F478 ; CPUSHA BC flush the data into memory
dc.w $4E71 ; nop
dc.w $F4D8 ; INVA BC invalidate the data and inst caches
dc.w $4E71 ; nop
dc.w $F518 ; PFLUSHA flush the address translation cache
dc.w $4E71 ; nop
ENDM
;; dc.w $F4F8 ; CPUSHA DC flush the data cache into memory
MOVQ MACRO *value
IFGT (127-(\1))
moveq #(\1),\2
MEXIT
ENDC
IFEQ ((\1)&%1)
IFGT (256-(\1))
moveq #(\1)>>1,\2
add.l \2,\2
MEXIT
ENDC
ENDC
IFGT (127-((\1)^$000000FF))
moveq #(\1)^$000000FF,\2
not.b \2
MEXIT
ENDC
move.l #(\1),\2
ENDM
SECTION CODE_C,CODE_C
Main move.l a0,a2
move.l d0,d2
moveq #RETURN_FAIL,d7
move.l (4).w,a6
move.l a6,_ExecBase
move.w (AttnFlags,a6),_AttnFlags
lea (DosName,pc),a1
moveq #0,d0
bsr OpenLib
move.l d0,d6
beq .exit
move.l d0,a6
moveq #0,d4 Set default!!
cmp.w #37,(LIB_VERSION,a6)
shs d5
bsr getmmu
move.b d0,_mmuflag
lea _Array,a3
tst.b d5
bne.b .ks20
clr.l -1(a2,d2.l)
subq.l #1,d2
beq.b .do RESTORE!
move.l a2,(a3)
lea (_13Help,pc),a0
cmp.b #'?',(a2)
bne.b .do
subq.l #1,d2
beq.b .printmsgexit
bra.b .do
.ks20 lea (_Template,pc),a0
move.l a0,d1
move.l a3,d2
moveq #0,d3
call ReadArgs
move.l d0,d4
beq.b .badargs
.do
move.l (ARG_QUIET,a3),_Quiet
tst.l (ARG_CPUCARD,a3)
beq.b .no_cpucard
bsr CheckCPUCard
sne _CPUCard
bne.b .has_cpucard
lea (NoCPUCard,pc),a0
bra.b .printmsgexit
.no_cpucard
bsr TestBliz
lea (RequiresBliz,pc),a0
move.l d0,_BlizROM
beq.b .printmsgexit
.has_cpucard
movem.l d4-d6/a6,-(sp)
moveq #RETURN_ERROR,d7
lea (Messu,pc),a0
bsr _PrintHeaderf
bsr _H